#include <stdio.h>
#include <unistd.h>
#include <cerrno>
#include <cstring>
#include <stdint.h>
#include <cstdlib>
#include <rockit/RTTaskNodeContext.h>
#include <rockit/RTTaskNode.h>
#include <rockit/RTMediaBuffer.h>
#include "../common/cae_intf.h"

#define kStubRockitDemo MKTAG('r', 'k', 'd', 'm')

// 创建外部节点， 外部节点需要继承RTTaskNode
// 基础接口需要完成open/process/close
RTTaskNode* createRockitDemoNode();
class RTRockitDemoNode : public RTTaskNode
{
public:
    RTRockitDemoNode();
    virtual ~RTRockitDemoNode();

    virtual RT_RET open(RTTaskNodeContext *context);
    virtual RT_RET process(RTTaskNodeContext *context);
    virtual RT_RET close(RTTaskNodeContext *context);

private:
    RT_RET my_process(RTMediaBuffer *src, RTMediaBuffer *dst);

    RT_RET filter(RTMediaBuffer *outputBuffer);

private:
    // 算法句柄
    CAE_HANDLE cae;
    
    // 算法占用内存空间
    char* mMem;

    FILE* handle;

    FILE* secondHandle;

    // 输出缓冲区
    RTMediaBuffer *outputBuffer;
};
